﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using PLAYXPERT.Windows;
using SKYPE4COMLib;

namespace SkypePXP
{
    public partial class IncomingCall : PXPForm
    {
        public event CommandHandler Command;
        public delegate void CommandHandler(DialogResult result, Call pCall);

        private Call pCall;

        public IncomingCall()
        {
            InitializeComponent();
        }

        public void ShowWindow(string test, Call pCall)
        {
            this.pCall = pCall;
            this.Show();
            label1.Text = test + " calling";
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Command(DialogResult.Yes, pCall);
            this.Hide();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Command(DialogResult.No, pCall);
            Cancel();
        }

        private void IncomingCall_FormClosing(object sender, FormClosingEventArgs e)
        {
            Command(DialogResult.No, pCall);
            e.Cancel = true;
            Cancel();
        }

        public void Cancel()
        {
            this.Hide();
            pCall = null;
        }
    }
}
